package com.backend.models;

import io.ebean.ExpressionList;
import io.ebean.Finder;
import io.ebean.Model;
import lombok.Data;

import javax.persistence.*;

@Entity
@Table(name = "product_genre")
@Data
public class ProductGenre extends Model {
    @Id
    public Integer id;
    public String name;

    @ManyToOne
    @JoinColumn(name = "master_genre_id")
    public ProductGenre masterGenre;

    public boolean deleted = false;

    public static Finder<Integer, ProductGenre> find = new Finder<>(ProductGenre.class);

    public static ExpressionList<ProductGenre> search() {
        return ProductGenre.find.query().where();
    }
}
